<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="root"></div>
<script src="../../javascript/react.development.js"></script>
<script src="../../javascript/react-dom.development.js"></script>
<script src="../../javascript/babel.min.js"></script>
<script type="text/babel">
    class App extends React.Component {

        state = {flag: true}

        render() {
            const {flag} = this.state
            return (
                <div className="app">
                    <h1>今天天气很{flag ? "炎热" : "凉爽"}</h1>
                    <button onClick={this.changeFlag}>切换</button>
                </div>
            );
        }

        changeFlag = () => {
            this.setState({flag: !this.state.flag})
        }

    }

    ReactDOM.render(<App></App>, document.querySelector("#root"))
</script>
</body>
</html>